<!DOCTYPE html>
<html>

  <head>
	<meta charset="UTF-8">
	<title>Xtext - Xtext 2.8.0 Release Notes</title>
	
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta name="description"
		content="The website of Eclipse Xtext, an open-source framework for development of programming languages and domain-specific languages">
	<meta name="author" content="Sven Efftinge">
	<meta name="author" content="Miro Spoenemann">
	<!--  styles -->
	<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
	<!--[if lt IE 9]>
	  <script src="https://html5shim.googlecode.com/svn/trunk/html5.js"></script>
	<![endif]-->
	
	<!-- Le fav and touch icons -->
	<link rel="shortcut icon" href="/Xtext/images/favicon.png">
	
	<link href="/Xtext/css/bootstrap.css" rel="stylesheet" type='text/css'>
	<link href="/Xtext/css/bootstrap-responsive.css" rel="stylesheet" type='text/css'>
	<link href="/Xtext/css/shield-responsive.css" rel="stylesheet" type='text/css'>
	<link href='/Xtext/css/fonts.css' rel='stylesheet' type='text/css'>
	<link href="/Xtext/css/prettyPhoto.css" rel="stylesheet" media="screen" type='text/css'>
	<link href="/Xtext/css/prettify.css" type="text/css" rel="stylesheet"/>
	<link href="/Xtext/css/style.css" rel="stylesheet" type='text/css'>
	<!-- cover flow -->
	<link href="/Xtext/css/coverflow.css" rel="stylesheet" type='text/css'>
	<!--[if lt IE 9]>
	  <link href="/css/iebugs.css" rel="stylesheet" type='text/css'>
	<![endif]-->

	<!-- BEGIN Cookie Consent
	<link rel="stylesheet" type="text/css" href="//cdnjs.cloudflare.com/ajax/libs/cookieconsent2/3.0.3/cookieconsent.min.css" />
	<script src="//cdnjs.cloudflare.com/ajax/libs/cookieconsent2/3.0.3/cookieconsent.min.js"></script>
	<script>
	window.addEventListener("load", function(){
	window.cookieconsent.initialise({
		"palette": {
		"popup": {
		  "background": "#000"
		},
		"button": {
		  "background": "#f1d600"
		}
		},
		"theme": "edgeless",
		"type": "opt-in",
		onInitialise: function (status) {
		  var type = this.options.type;
		  var didConsent = this.hasConsented();
		  if (type == 'opt-in' && didConsent) {
		    // TODO: enable cookies
		  }
		  if (type == 'opt-out' && !didConsent) {
		    // TODO: disable cookies
		  }
		},
		onStatusChange: function(status, chosenBefore) {
		  var type = this.options.type;
		  var didConsent = this.hasConsented();
		  if (type == 'opt-in' && didConsent) {
		    // TODO: enable cookies
		  }
		  if (type == 'opt-out' && !didConsent) {
		    // TODO: disable cookies
		  }
		}, 
		onRevokeChoice: function() {
		  var type = this.options.type;
		  if (type == 'opt-in') {
		    // TODO: disable cookies
		  }
		  if (type == 'opt-out') {
		    // TODO: enable cookies
		  }
		},
		"content": {
		"href": "https://www.eclipse.org/legal/privacy.php"
		}
	})});
	</script>
	END Cookie Consent -->
</head>


  <body>
  
    <header class="site-header">

  <!-- Navbar -->
  <div class="navbar navbar-fixed-top">
    <div class="navbar-inner">
      <div class="container">
        <a class="btn btn-navbar" data-toggle="collapse"
          data-target=".nav-collapse"> <span class="icon-bar"></span> <span
          class="icon-bar"></span> <span class="icon-bar"></span>
        </a> <a class="brand" href="/Xtext/index.html"></a>
        <div class="nav-collapse collapse" style="height: 0px;">
          <ul class="nav">
            <!--li ><a href="/Xtext/news.html">News</a></li-->
            <li ><a href="/Xtext/download.html">Download</a></li>
            <li ><a href="/Xtext/documentation/index.html">Documentation</a></li>
            <li ><a href="/Xtext/community.html">Community</a></li>
            <li class="dropdown">
              <a class="dropdown-toggle" data-toggle="dropdown" href="#">Support &amp; Trainings<span class="caret"></span></a>
              <ul class="dropdown-menu">
                <li><a href="https://info.itemis.com/professional-xtext-support" target="_blank">itemis</a></li>
                <li><a href="https://www.typefox.io/language-engineering/" target="_blank">TypeFox</a></li>
              </ul>
            </li>
            <li ><a href="https://eclipse.dev/Xtext/xtend">Xtend</a></li>
          </ul>
          <!--div class="nav pull-right">
            <li ><a><iframe src="https://ghbtns.com/github-btn.html?user=eclipse&repo=xtext&type=star&count=true" frameborder="0" scrolling="0" width="170px" height="20px"></iframe></a></li>
          </div-->
        </div>
        <!--/.nav-collapse -->
      </div>
    </div>
  </div>
  <!-- Navbar End -->

</header>


    <div class="page-content">
  <div class="wrapper">
    <div id="page">  
    	<div class="inner">
    		<br/><br/>
    		<div id="maincontainer" class="container">
    			<div class="span8 offset1">
    				<h1>Xtext 2.8.0 Release Notes</h1>
    				<h4>Mar 11, 2015</h4>
    				<br/>
    				<p>Version 2.8.0 comes with over 260 bugfixes and enhancements, the runtime performance as well as the tool performance has been improved significantly. The full bugzilla log can be found <a href="https://bugs.eclipse.org/bugs/buglist.cgi?bug_status=RESOLVED&amp;bug_status=VERIFIED&amp;bug_status=CLOSED&amp;f0=OP&amp;f1=OP&amp;f3=CP&amp;f4=CP&amp;j1=OR&amp;list_id=11172029&amp;query_format=advanced&amp;status_whiteboard=v2.8&amp;status_whiteboard_type=allwordssubstr">here</a>.</p>

<p>The following features have been added in particular.</p>

<h2 id="whitespace-aware-languages">Whitespace-Aware Languages</h2>

<p>Xtext 2.8 supports languages in which whitespace is used to specify the structure, e.g. using indentation to delimit code blocks as in <a href="https://www.python.org">Python</a>. This is done through <em>synthetic tokens</em> defined in the grammar:</p>

<pre><code class="language-xtext">terminal BEGIN: 'synthetic:BEGIN';
terminal END: 'synthetic:END';
</code></pre>

<p>These tokens can be used like other terminals in grammar rules:</p>

<pre><code class="language-xtext">WhitespaceAwareBlock:
    BEGIN
        ...
    END;
</code></pre>

<p>The new example language <em>Home Automation</em> available in the Eclipse examples (<em>File → New → Example → Xtext Examples</em>) demonstrates this concept. It allows code like the following:</p>

<pre><code class="language-ruleengine">Rule 'Report error' when Heater.error then
    var String report
    do
        Thread.sleep(500)
        report = HeaterDiagnostic.readError
    while (report == null)
    println(report)
</code></pre>

<p>More details are found in the <a href="/Xtext/documentation/307_special_languages.html#whitespace-aware-languages">documentation</a>.</p>

<h2 id="enhancements-of-the-grammar-editor">Enhancements of the Grammar Editor</h2>

<h4 id="configurable-severities">Configurable Severities</h4>
<p>You can configure the severity (<em>ignore / warning / error</em>) of certain problems that are detected in a grammar file. Open <em>Xtext → Errors/Warnings</em> in the workspace preferences for global settings or in the project properties for project-specific settings.</p>

<p><img src="/Xtext/images/releasenotes/2_8_xtext-validation-preferences.png" alt="" /></p>

<h4 id="improved-content-assist">Improved Content Assist</h4>
<p>When you hit <em>Ctrl+Space</em> after the <code>with</code> keyword in a grammar definition, you get a list of available grammars which the currently edited grammar can inherit from.</p>

<p><img src="/Xtext/images/releasenotes/2_8_xtext-grammar-inheritance.png" alt="" /></p>

<h2 id="new-options-for-language-code-generation">New Options for Language Code Generation</h2>

<p>The <em>Generator</em> component supports two new options.</p>

<h4 id="class-annotations">Class Annotations</h4>

<p>You can specify annotations to be added to each generated Java class. With the following workflow configuration, the annotation <code>@Generated</code> is added to each class:</p>

<pre><code class="language-mwe2">Workflow {
  component = Generator {
      classAnnotation = GeneratedClassAnnotation {}
      ...
  }
}
</code></pre>

<p>You can also specify your own class annotations by implementing the interface <em>IClassAnnotation</em> and adding that implementation to the configuration.</p>

<h4 id="file-header">File Header</h4>

<p>Xtext generates Java files with the following file header comment:</p>

<pre><code class="language-java">/*
 * generated by Xtext
 */
</code></pre>

<p>With Xtext 2.8, this can be configured in the workflow configuration with the <em>fileHeader</em> property of the <em>Generator</em> component.</p>

<pre><code class="language-mwe2">var myFileHeader = "/*----------------------------
 * My fancy file header
 * (c) \${year} Dr. Evil, inc.
 *----------------------------*/"

Workflow {
  component = Generator {
      fileHeader = myFileHeader
      ...
  }
}
</code></pre>

<h2 id="target-java-version-xbase">Target Java Version (Xbase)</h2>

<p>The new version of the Xbase compiler allows to configure the Java version of the generated code. The default is to use the same version as set for the source compatibility of the Java compiler (<em>Java → Compiler → Source compatibility</em>), which is in turn usually set to the same version as the <em>compiler compliance level</em>. The Xbase compiler settings can be configured in the <em>Compiler</em> preference page or project properties page of your Xbase language.</p>

<p><img src="/Xtext/images/releasenotes/2_8_xbase-java-version.png" alt="" /></p>

<p>By unchecking <em>Use source compatibility level from Java settings</em>, you can choose to generate Java code with a different version than is set for the Java compiler. The actual changes in the generated code are described in the following.</p>

<h3 id="java-5">Java 5</h3>

<p>Java 5 has been the default version level of the Xbase compiler from the beginning, so the generated code is the same as with earlier Xbase versions if you choose this target version.</p>

<h3 id="java-6">Java 6</h3>

<p>When the Xbase compiler is set to at least Java 6, it generates an <code>@Override</code> annotation to each method that overrides a method from a superclass or implements an interface method.</p>

<h3 id="java-7">Java 7</h3>

<p>Xbase expressions like <code>switch (obj) { ... }</code> where <code>obj</code> is of type <a href="https://docs.oracle.com/javase/11/docs/api/java/lang/String.html">String</a> are translated to Java <code>switch</code> statements (see <a href="https://docs.oracle.com/javase/8/docs/technotes/guides/language/strings-switch.html">Strings in switch Statements</a>).</p>

<p>In Xbase you can write number literals in the form <code>2_147_483_647</code> to enhance their readability. This is also <a href="https://docs.oracle.com/javase/8/docs/technotes/guides/language/underscores-literals.html">supported by Java 7</a>. When the Xbase compiler is set to at least Java 7, underscores in number literals are retained in the generated code.</p>

<h3 id="java-8">Java 8</h3>

<p><a href="/Xtext/documentation/305_xbase.html#xbase-expressions-lambda">Xbase lambda expressions</a> like <code>[String s | s.toLowerCase]</code> are translated to <a href="https://docs.oracle.com/javase/tutorial/java/javaOO/lambdaexpressions.html">Java 8 lambda expressions</a>, e.g. <code>(String s) -&gt; return s.toLowerCase();</code>. More details on this translation are discussed in <a href="https://spoenemann.blogspot.de/2015/02/xtend-for-java-8.html">this blog post</a>.</p>

<p>Note that independent of which Java version is chosen for the generated code, Xbase works perfectly with the <a href="https://docs.oracle.com/javase/8/docs/technotes/guides/language/lambda_api_jdk8.html">lambda-optimized Java 8 API</a> because Xbase lambdas are fully compatible with Java 8 lambdas.</p>

<h2 id="more-compiler-options-xbase">More Compiler Options (Xbase)</h2>

<p>You can now disable the automatic generation of <code>@SuppressWarnings</code> annotations for generated classes. Furthermore, you can enable the generation of <code>@Generated</code> annotations for all generated types, which can be useful for automatic processing of the source code, e.g. when you want to exclude generated types in code analysis tools. The annotation also allows to attach more information, which can be enabled in the preferences.</p>

<h2 id="unique-class-name-validation-xbase">Unique Class Name Validation (Xbase)</h2>

<p>Unique Java type name checks are now activated for all Xbase languages on a per project level.</p>

<h2 id="open-generated-file-xbase">Open Generated File (Xbase)</h2>

<p>You can open the Java file that was generated from an Xbase DSL instance by right-clicking the DSL editor and selecting <em>Open Generated File</em>.</p>

<p><img src="/Xtext/images/releasenotes/2_8_xbase-open-generated.png" alt="" /></p>

<h2 id="interruption-of-incremental-build">Interruption of Incremental Build</h2>

<p>Instead of blocking the user with a modal dialog, running incremental builds will be now get interrupted when a user saves a file. Less blocking, yay!</p>

<h2 id="new-formatter-provisional">New Formatter (Provisional)</h2>

<p>Xtext 2.8 comes with a new formatting API in addition to the previous API. The new API allows to implement formatting not only based on the static structure of the grammar but also on the actual model structure. This overcomes many limitations of the previous API, which was present since the first version of Xtext. Things that are now possible include:</p>

<ul>
  <li>Add line breaks to long lists of items but keep short lists in one line.</li>
  <li>Arrange elements in a tabular layout.</li>
  <li>Apply formatting to values of data type rules or comments.</li>
  <li>Consider the existing whitespace information and implement an adaptive layout.</li>
  <li>Provide user configurable preferences for the formatting settings.</li>
</ul>

<p>More details are found in the <a href="/Xtext/documentation/303_runtime_concepts.html#formatting">documentation</a>.</p>

<h2 id="storable-resources-provisional">Storable Resources (Provisional)</h2>

<p>Full resolution of Xtext resources can be very expensive. During compilation, complex languages like Xtend go through different phases that involve a lot of computation. With 2.8 we have introduced the possibility to store computed resource state and load it on demand if no changes are expected. We have activated this for Xtend and it reduces the amount of work for incremental changes significantly as dependent resources get loaded from storage much quicker. The API is still provisional for now.</p>

<h2 id="xtend-features">Xtend Features</h2>

<h4 id="convert-java-to-xtend">Convert Java to Xtend</h4>
<p>The new version features a Java-to-Xtend converter. Right-click a Java file, package or source folder in the Package Explorer and select <em>Convert to Xtend</em>. You can choose to keep the original Java files (though that will lead to errors due to duplicate types), and you are warned if the Java code contains parts that cannot be translated automatically. These are marked with <code>FIXME</code> comments in the Xtend code. However, the converter is able to convert the majority of Java classes without problems.</p>

<h4 id="more-java-8-support">More Java 8 Support</h4>
<p>The new version of Xtend of course includes all enhancements of Xbase described above, including support for Java 8. In addition, Xtend allows to define non-abstract methods (static or non-static) in interfaces when Java 8 is chosen as target language level. If such a method is non-static, it is translated to a <a href="https://docs.oracle.com/javase/tutorial/java/IandI/defaultmethods.html">Java 8 default method</a>.</p>

<h2 id="important-changes">Important Changes</h2>

<h4 id="execution-environment">Execution Environment</h4>
<p>All Xtext plug-ins now require JavaSE-1.6 as execution environment. Furthermore, the Java code generated by Xtext uses <code>@Override</code> annotations for methods overriding or implementing other declared methods, so the plug-ins into which this code is generated must use at least JavaSE-1.6 as execution environment. If your plug-ins are set to J2SE-1.5 and you run the Xtext 2.8 code generator, you will probably get compiler errors like <em>The method ‘m’ of type ‘T’ must override a superclass method</em>; eliminate them by switching to a higher Java version.</p>

<h4 id="regenerate-your-xbase-languages">Regenerate Your Xbase Languages</h4>
<p>Xbase languages need to be regenerated once in order to work with version 2.8.</p>

<h4 id="expiring-junit-3-support">Expiring JUnit 3 Support</h4>
<p>We are planing to remove support for JUnit version 3. The code form the plug-ins <code>org.eclipse.xtext.junit</code> and <code>org.eclipse.xtext.ui.junit</code> will be removed from our repository in the next version. Please migrate to the respective counterparts in <code>org.eclipse.xtext.junit4</code>.</p>

    			</div>
    		</div>
      </div>
    </div>
  </div>
</div>
    
    <footer class="site-footer">
  <div id="extra">
    <div class="inner">
      <div class="container">
        <div class="row">
          <div class="span6">
            <h3 class="footer-links-header">Quick Links</h3>
            <ul class="footer-links clearfix">
              <li><a href="https://www.eclipse.org/legal/privacy.php">Privacy Policy</a></li>
              <li><a href="https://www.eclipse.org/legal/termsofuse.php">Terms of Use</a></li>
              <li><a href="https://www.eclipse.org/legal/copyright.php">Copyright Agent</a></li>
              <li><a href="https://www.eclipse.org/legal/">Legal</a></li>
            </ul>
            <ul class="footer-links clearfix">
              <li><a href="https://www.eclipse.org">Eclipse Home</a></li>
              <li><a href="https://marketplace.eclipse.org/">Market Place</a></li>
              <li><a href="https://www.planeteclipse.org/">Eclipse Planet</a></li>
              <li><a href="https://www.eclipse.org/forums/index.php/f/27/">Xtext Forum</a></li>
            </ul>
            <br/><br/>
            Xtext is a trademark of the Eclipse Foundation, Inc. and is used with permission
            <br/><br/>
            <img src="/Xtext/images/eclipse-foundation-white-orange.svg" alt="Eclipse Foundation"/>
          </div>
          <div class="span6">
            <!-- Social Media Links -->
            <h3 class="footer-links-header">Social Media</h3>
            <ul class="footer-links clearfix">
              <li>
                <a href="https://twitter.com/xtext"><img src="/Xtext/images/Twitter-bird-darkgray.png" class="img-responsive" style="margin-right: 5px;height: 1em;" alt="Twitter icon">@xtext on Twitter</a>
              </li>
            </ul>
          </div>
        </div>
      </div>
    </div>
  </div>
  <a href="#" class="scrollup fadeOutRight animated" style="display: none;">ScrollUp</a>
  <!-- Le javascript
      ================================================== -->
  <!-- Placed at the end of the document so the pages load faster -->
  
  <script src="/Xtext/js/jquery-1.11.3.min.js"></script>
  <script src="/Xtext/js/bootstrap.min.js"></script>
  <script src="/Xtext/js/jquery.easing.1.3.js" type="text/javascript"></script>
  <script src="/Xtext/js/jquery.prettyPhoto.js" type="text/javascript"></script>
  <script src="/Xtext/js/prettify.js" type="text/javascript"></script>
  <script src="/Xtext/js/lang-xtend.js" type="text/javascript"></script>
  <script src="/Xtext/js/lang-common.js" type="text/javascript"></script>
  <script src="/Xtext/js/custom.js" type="text/javascript"></script>
  <!--script src="https://apis.google.com/js/platform.js" async defer></script-->
  <!--script type="text/javascript">
    var _gaq = _gaq || [];  
      _gaq.push([ '_setAccount', 'UA-2429174-3' ]);
    _gaq.push([ '_trackPageview' ]);
    (function() {
      var ga = document.createElement('script');
      ga.type = 'text/javascript';
      ga.async = true;
      ga.src = ('https:' == document.location.protocol ? 'https://ssl'
          : 'https://www')
          + '.google-analytics.com/ga.js';
      var s = document.getElementsByTagName('script')[0];
      s.parentNode.insertBefore(ga, s);
    })();
  </script-->
  <script src="/Xtext/js/coverflow.min.js" type="text/javascript"></script>
  <script>
      $(function() {
        $('#coverflow').coverflow({
          active : 1,
          visibleAside: 2,
          overlap : 0.5,
          scale : 0.9,
          angle : 20,
          trigger : {
            "itemfocus" : true,
            "swipe" : true,
            "mousewheel" : false
          }
        });
        $('#coverflow :hidden').toggle();
        $(window).resize(function() {
          $('#coverflow').coverflow();
        });
      });

  </script>
</footer>


  </body>

</html>
